home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / AddOns / Delphi 5 Companion Tools CD / FreeWare / EPHINTS / EPHINTS.ZIP / HintMain.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-07-13  |  2.6 KB  |  117 lines

  1. unit HintMain;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, EPHints, ExtCtrls, AppEvnts;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Button1: TButton;
  12.     Label1: TLabel;
  13.     Button2: TButton;
  14.     Button3: TButton;
  15.     Button4: TButton;
  16.     Label2: TLabel;
  17.     Label3: TLabel;
  18.     Label4: TLabel;
  19.     Button5: TButton;
  20.     Button6: TButton;
  21.     EPHints1: TEPHints;
  22.     procedure Button1Click(Sender: TObject);
  23.     procedure Button2Click(Sender: TObject);
  24.     procedure FormCreate(Sender: TObject);
  25.     procedure Button5Click(Sender: TObject);
  26.     procedure Button6Click(Sender: TObject);
  27.   private
  28.     procedure UpdateColors;
  29.   public
  30.     { Public declarations }
  31.   end;
  32.  
  33. var
  34.   Form1: TForm1;
  35.  
  36. implementation
  37.  
  38. uses Unit2;
  39.  
  40. {$R *.DFM}
  41.  
  42. procedure TForm1.Button1Click(Sender: TObject);
  43. begin
  44.   EPHints1.Tag:=EPHints1.Tag+1;
  45.   If EPHints1.Tag>2 Then EPHints1.Tag:=0;
  46.   case EPHints1.Tag of
  47.     0: begin
  48.          EPHints1.Enabled:=False;
  49.          Button1.Caption:='EPHints Disabled';
  50.        end;
  51.     1: begin
  52.          EPHints1.Enabled:=True;
  53.          EPHints1.HintType:=ephtNormal;
  54.          Button1.Caption:='Normal EPHints';
  55.        end;
  56.     2: begin
  57.          EPHints1.Enabled:=True;
  58.          EPHints1.HintType:=ephtBaloon;
  59.          Button1.Caption:='Baloon EPHints';
  60.        end;
  61.   end;
  62. end;
  63.  
  64. procedure TForm1.Button2Click(Sender: TObject);
  65. var
  66.   AColor: TColor;
  67. begin
  68.   With TColorDialog.Create(nil) do
  69.   try
  70.     if Execute then
  71.     begin
  72.       AColor:=Color;
  73.       case TButton(Sender).Tag of
  74.         0:EPHints1.HintColor:=AColor;
  75.         1:EPHints1.HintBorderColor:=AColor;
  76.         2:EPHints1.HintTextColor:=AColor;
  77.       end;
  78.       UpdateColors;
  79.     end;
  80.   finally
  81.     Free;
  82.   end;
  83. end;
  84.  
  85. procedure TForm1.UpdateColors;
  86. begin
  87.   Label2.Caption:=ColorToString(EPHints1.HintColor);
  88.   Label2.Font.Color:=EPHints1.HintColor;
  89.   Label3.Caption:=ColorToString(EPHints1.HintBorderColor);
  90.   Label3.Font.Color:=EPHints1.HintBorderColor;
  91.   Label4.Caption:=ColorToString(EPHints1.HintTextColor);
  92.   Label4.Font.Color:=EPHints1.HintTextColor;
  93.   If EPHints1.DefaultColors then
  94.     Button5.Caption:='Use Custom Hint Colors'
  95.   else
  96.     Button5.Caption:='Use Default Hint Colors';
  97. end;
  98.  
  99. procedure TForm1.FormCreate(Sender: TObject);
  100. begin
  101.   UpdateColors;
  102. end;
  103.  
  104. procedure TForm1.Button5Click(Sender: TObject);
  105. begin
  106.   EPHints1.DefaultColors:=not EPHints1.DefaultColors;
  107.   UpdateColors;
  108. end;
  109.  
  110. procedure TForm1.Button6Click(Sender: TObject);
  111. begin
  112.   With TForm2.Create(nil) do
  113.     Show;
  114. end;
  115.  
  116. end.
  117.